<template>
  <div>
    <div v-for="i in cate" :key="i.id">
      <van-collapse style="width: 150px" v-model="name" accordion>
        <van-collapse-item :title="i.name" :name="i.id" @click="add(i.id)">
          <p v-for="j in caozuo" :key="j.id">
            <van-button @click="jump(j.id)">{{ j.name }}</van-button>
          </p>

        </van-collapse-item>

      </van-collapse>
    </div>
  </div>
</template>

<script>
import maxios from "@/http/axios";

export default {
  name: "left",
  data() {
    return {
      name: "",
      cate: [],
      caozuo: []

    }
  },
  methods: {
    get_cate() {
      maxios('/cate/cate', 'get').then(res => {
        if (res.code == 200) {
          this.cate = res.list
        }

      })

    },
    add(id) {
      maxios('/cate/caozuo?id=' + id, 'get').then(res => {
        if (res.code == 200) {
          this.caozuo = res.list
        }
      })
    },
    jump(id) {
      if (id == 1) {
        this.$router.push('/zuzhi')
      }
    }
  },
  mounted() {
    this.get_cate()
  }
}
</script>

<style scoped>

</style>